#!/bin/bash
for line in $(cat $1)
do
    first=`echo ${line} | cut -d , -f 1`
    second=`echo ${line} | cut -d , -f 2`
    third=`echo ${line} | cut -d , -f 3`
    curl "http://192.168.236.1:7001/api/user/addUser" -H "Content-Type:application/json" -X POST -d '{
        "requestHead":{
            "tranSeqNo":"tran'"$(date +%Y%m%d%H%M%S)"'AAAA'"$(top -d 1 -n 1 |md5sum|cut -c 1-8)"'",
            "tranTime":"'"$(date +%Y%m%d)"'",
            "tranDate":"'"$(date +%H%M%S)"'"
        },
        "requestBody":{
            "id":'$first',
            "name":"'"$second"'",
            "adress":"'"$third"'",
            "remark":"新增用户备注说明"
        }
    }' | grep -w '"message":"ok"'
    if [ $? -eq 0 ];then
        echo "success"
    else
        echo $line
        echo "fail"
    fi
done